package com.pointcircle.core.web;

import java.io.Serializable;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.pointcircle.core.JpaBaseEntity;

public interface IFindByIdRest<T extends JpaBaseEntity<ID>, ID extends Serializable, 
	EV extends EntityVo<T, ID>> 
	extends IRest<T, ID, EV> {

	@GetMapping("/findById")
	default RestResponseElement findById(@RequestParam("id") ID id) {
		T entity = getRepository().findById(id).orElse(null);
		return this.createRestResponseElement(entity);
	}
}
